package com.indexingsystem.system.service.impl;

import com.github.pagehelper.PageHelper;
import com.indexingsystem.boss.Vo.ProductThemeTableReqVo;
import com.indexingsystem.boss.Vo.ProductThemeTableResVo;
import com.indexingsystem.boss.admin.mapper.IdxIndexingProductsCheckMapper;
import com.indexingsystem.boss.common.PagedResult;
import com.indexingsystem.boss.entity.IdxIndexingProductsCheck;
import com.indexingsystem.boss.utils.BeanUtils;
import com.indexingsystem.system.service.IdxIndexingProductsCheckService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

//标引产品审核（历史审核记录）

//
@Service
public class IdxIndexingProductsCheckServiceImpl implements IdxIndexingProductsCheckService {

    @Resource
    private IdxIndexingProductsCheckMapper idxIndexingProductsCheckMapper;

    @Override
    public int deleteByPrimaryKey(String checkId) {
        // TODO Auto-generated method stub
        return idxIndexingProductsCheckMapper.deleteByPrimaryKey(checkId);
    }

    @Override
    public int insert(IdxIndexingProductsCheck record) {
        // TODO Auto-generated method stub
        return idxIndexingProductsCheckMapper.insert(record);
    }

    @Override
    public int insertSelective(IdxIndexingProductsCheck record) {
        // TODO Auto-generated method stub
        return idxIndexingProductsCheckMapper.insertSelective(record);
    }

    @Override
    public IdxIndexingProductsCheck selectByPrimaryKey(String checkId) {
        // TODO Auto-generated method stub
        return idxIndexingProductsCheckMapper.selectByPrimaryKey(checkId);
    }

    @Override
    public int updateByPrimaryKeySelective(IdxIndexingProductsCheck record) {
        // TODO Auto-generated method stub
        return idxIndexingProductsCheckMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKeyWithBLOBs(IdxIndexingProductsCheck record) {
        // TODO Auto-generated method stub
        return idxIndexingProductsCheckMapper.updateByPrimaryKeyWithBLOBs(record);
    }

    @Override
    public int updateByPrimaryKey(IdxIndexingProductsCheck record) {
        // TODO Auto-generated method stub
        return idxIndexingProductsCheckMapper.updateByPrimaryKey(record);
    }

    @Override
    public PagedResult<ProductThemeTableResVo> getProductThemeTableList(ProductThemeTableReqVo record) {
        Integer pageNo = record.getPageNo() == null ? 1 : record.getPageNo();
        Integer pageSize = record.getPageSize() == null ? 20 : record.getPageSize();
        // startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
        PageHelper.startPage(pageNo, pageSize);
        return BeanUtils.toPagedResult(idxIndexingProductsCheckMapper.selectSelective(record));
    }

}
